package playn.game.menu.states;

import playn.core.GroupLayer;
import playn.core.Keyboard.Event;
import playn.game.core.Button;
import playn.game.core.Game;
import playn.game.core.State;
import playn.game.menu.Menu;

public class Action extends State {

	public Action(GroupLayer layer){
		super(layer);
		name="ACTION";
		map=Game.maps.get("Action.tmx");
	}
	
	@Override
	public void start(){
		super.start();
		transition.addIn(Game.level.layer);

		Game.action=true;
	}
	
	@Override
	public void onKeyDown(Event event){
	    switch (event.key()) {
	      case G:{
				Game.menu.switchTo(Menu.GAMEOVER);
		    	  break;
	      }
	      case C:{
				Game.menu.switchTo(Menu.CONTINUE);
		    	  break;
	      }
	      case P:{
				Game.action=false;
				Game.menu.switchTo(Menu.PAUSE);
		    	  break;
	      }
	    }
	}
	
	@Override
	public void onPress(Button button){
		if(button.id().equalsIgnoreCase(Pause.PAUSE_BUTTON_ID)){
			Game.action=false;
			Game.menu.switchTo(Menu.PAUSE);
		}
		else{
			super.onPress(button);
		}
	}


	
	
}
